package utility.display;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;

public class Form {

	   public static void centerWindow(Component frame)
	   {
		   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		   Dimension frameSize = frame.getSize();
		   if ( frameSize.width > screenSize.width )
			   frameSize.width = screenSize.width;
		   if ( frameSize.height > screenSize.height )
			   frameSize.height = screenSize.height;
		   frame.setLocation ((screenSize.width - frameSize.width) >> 1, ((screenSize.height - frameSize.height) / 2) >> 1 );
	   } 
	
}
